# llm序列化
import os
os.environ["openai_api_key"] = "sk-dqRjVh22RuqhoWNNfwtbPaOrRR5vbsmToMP0NYEUKC0id7xw"
os.environ["openai_api_base"] = "https://api.chatanywhere.tech/v1"
# 序列化
from langchain_openai import OpenAI

llm = OpenAI(temperature = 0, max_tokens = 256)

llm.save("llm.json")
llm.save("llm.yaml")

# 读取,主要这里需要把api_key写道环境变量里，否则会报错
# json文件里一部分值不是llm要求的参数，不清楚作用
from langchain_community.llms.loading import load_llm
llm2 = load_llm("llm.json")
# load_llm("llm2.yaml") 